﻿#include <QtGui>
#include <QtWidgets>
#include <QMediaPlayer>
#include <QTimer>
#include "fmod.h"
#include "fmod_errors.h"
#include "CurvePlot.h"
namespace Ui {
class SoundGradeWgt;
}

class SoundGradeWgt : public QWidget
{
    Q_OBJECT

public:
    explicit SoundGradeWgt(QWidget *parent = 0);
    ~SoundGradeWgt();

private:
    Ui::SoundGradeWgt *ui;
    CurvePlot *_curvePlot=nullptr;
    QStringList pathList;//本组声音

    QTimer timer;
    QVector<float>wav;
    FMOD_SYSTEM *system;
    FMOD_SOUND *sound;
    FMOD_CHANNEL *channel;
    FMOD_RESULT result;
    QString strFile;
    bool isPlaying=false;

    void plotAllWav(char *fileName);
    void initSliderQSS();
private slots:
    void pausePlay();
    void Play();
    void stopPlay();
    void onTimer();
    void on_pushButton_clicked();

    void on_pbt_pre_clicked();
    void on_pushButton_2_clicked();
    void on_horizontalSlider_sliderMoved(int position);
};
